<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			function Student(stuId, stuName) {
				this.stuId = stuId;
				this.stuName = stuName;
			}

			var stus = [];
			var n = 0;
			var flag = false;
			var index = prompt("1.登录2.退出");
			switch (index) {
				case "1":
					do {
						var name = prompt("请输入用户名");
						var password = prompt("请输入密码");
						if (name == 'zhangsan' && password == '123') {
							break;
						}
					} while (true);

					do {
						var choice = prompt("1.添加2.删除3.遍历4.修改5.退出");
						switch (choice) {
							case "1":
								//添加
								var stuId = prompt("请输入学号");
								var stuName = prompt("请输入姓名");
								/* var stu = {
									stuId: stuId,
									stuName: stuName
								}; */
								var stu = new Student(stuId, stuName);
								stus[n] = stu;
								n++;
								break;
							case "2":
								//删除
								break;
							case "3":
								for (var i = 0; i < stus.length; i++) {
									var s = stus[i];
									// document.write(s.stuId + "," + s.stuName);
									
								}
								//查询
								break;
							case "4":
								//修改
								break;
							case "5":
								//退出
								flag = true;
								break;
						}
					} while (!flag);
					break;
				case "2":
					break;
				default:
					console.log("输入错误，请重新输入");
			}
			console.log("谢谢使用");
		</script>
	</body>
</html>
